<html>
<head><meta charset="utf-8"><title>chalk dyn and impl Trait · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/chalk.20dyn.20and.20impl.20Trait.html">chalk dyn and impl Trait</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="178399390"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/chalk%20dyn%20and%20impl%20Trait/near/178399390" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/chalk.20dyn.20and.20impl.20Trait.html#178399390">(Oct 17 2019 at 16:48)</a>:</h4>
<p>Hi! I made a sketch for integrating the dyn and impl Trait support and filed it as <a href="https://github.com/rust-analyzer/rust-analyzer/pull/2026" target="_blank" title="https://github.com/rust-analyzer/rust-analyzer/pull/2026">https://github.com/rust-analyzer/rust-analyzer/pull/2026</a>. It compiles, but I've no idea if it's doing anything sane. Maybe someone can take a look or even continue with the implementation?</p>



<a name="178399460"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/chalk%20dyn%20and%20impl%20Trait/near/178399460" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/chalk.20dyn.20and.20impl.20Trait.html#178399460">(Oct 17 2019 at 16:49)</a>:</h4>
<p>I guess adding a test could help with trying out the sketch!</p>



<a name="178399653"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/chalk%20dyn%20and%20impl%20Trait/near/178399653" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/chalk.20dyn.20and.20impl.20Trait.html#178399653">(Oct 17 2019 at 16:51)</a>:</h4>
<p>There's already some tests that fail (:</p>



<a name="178402626"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/chalk%20dyn%20and%20impl%20Trait/near/178402626" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/chalk.20dyn.20and.20impl.20Trait.html#178402626">(Oct 17 2019 at 17:28)</a>:</h4>
<p>I've actually also already a branch, but it doesn't work yet because the Chalk support isn't quite working yet :)</p>



<a name="178402674"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/chalk%20dyn%20and%20impl%20Trait/near/178402674" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/chalk.20dyn.20and.20impl.20Trait.html#178402674">(Oct 17 2019 at 17:28)</a>:</h4>
<p>I considered making a draft PR, but thought I'd leave it for now because it may still take some time...</p>



<a name="178402871"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/chalk%20dyn%20and%20impl%20Trait/near/178402871" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/chalk.20dyn.20and.20impl.20Trait.html#178402871">(Oct 17 2019 at 17:31)</a>:</h4>
<p>i.e. I'm pretty sure that this won't work until there's some more work done in Chalk</p>



<a name="178403139"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/chalk%20dyn%20and%20impl%20Trait/near/178403139" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/chalk.20dyn.20and.20impl.20Trait.html#178403139">(Oct 17 2019 at 17:34)</a>:</h4>
<p>my commit is here <a href="https://github.com/flodiebold/rust-analyzer/commit/293bf2c6b810346d6994d76a697e6913a25c8d6c" target="_blank" title="https://github.com/flodiebold/rust-analyzer/commit/293bf2c6b810346d6994d76a697e6913a25c8d6c">https://github.com/flodiebold/rust-analyzer/commit/293bf2c6b810346d6994d76a697e6913a25c8d6c</a>, it's pretty similar :)</p>



<a name="178403854"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/chalk%20dyn%20and%20impl%20Trait/near/178403854" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/chalk.20dyn.20and.20impl.20Trait.html#178403854">(Oct 17 2019 at 17:42)</a>:</h4>
<p>oh, yeah, it's basically the same thing</p>



<a name="178404048"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/chalk%20dyn%20and%20impl%20Trait/near/178404048" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/chalk.20dyn.20and.20impl.20Trait.html#178404048">(Oct 17 2019 at 17:44)</a>:</h4>
<p>so do you also get the "cannot unify things with binders (other than types)" panic?</p>



<a name="178404107"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/chalk%20dyn%20and%20impl%20Trait/near/178404107" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/chalk.20dyn.20and.20impl.20Trait.html#178404107">(Oct 17 2019 at 17:44)</a>:</h4>
<p>yes, that's the thing where I'm pretty sure it's a problem in Chalk</p>



<a name="178404161"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/chalk%20dyn%20and%20impl%20Trait/near/178404161" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/chalk.20dyn.20and.20impl.20Trait.html#178404161">(Oct 17 2019 at 17:45)</a>:</h4>
<p>ah, I assumed that passing 1 there was bogus</p>



<a name="178404183"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/chalk%20dyn%20and%20impl%20Trait/near/178404183" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/chalk.20dyn.20and.20impl.20Trait.html#178404183">(Oct 17 2019 at 17:45)</a>:</h4>
<p>because Niko wrote in the corresponding topic in the traits wg</p>
<blockquote>
<p>a sample test (which fails) is on this branch -- it panics in unification because we need to write a routine for unifying QuantifiedWhereClauses</p>
</blockquote>



<a name="178404350"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/chalk%20dyn%20and%20impl%20Trait/near/178404350" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/chalk.20dyn.20and.20impl.20Trait.html#178404350">(Oct 17 2019 at 17:47)</a>:</h4>
<p>no, 1 should be always correct for the number of binders on dyn/impl as far as I understand it -- the one binder is the existential "self" parameter (e.g. <code>dyn Trait</code> is basically <code>exists&lt;T&gt; where T: Trait</code>)</p>



<a name="178404387"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/chalk%20dyn%20and%20impl%20Trait/near/178404387" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/chalk.20dyn.20and.20impl.20Trait.html#178404387">(Oct 17 2019 at 17:47)</a>:</h4>
<p>ah, okay</p>



<a name="178404445"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/chalk%20dyn%20and%20impl%20Trait/near/178404445" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/chalk.20dyn.20and.20impl.20Trait.html#178404445">(Oct 17 2019 at 17:48)</a>:</h4>
<p>I didn't see that wg-traits discussion, I wasn't subscribed :-D</p>



<a name="178660779"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/chalk%20dyn%20and%20impl%20Trait/near/178660779" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/chalk.20dyn.20and.20impl.20Trait.html#178660779">(Oct 21 2019 at 14:33)</a>:</h4>
<blockquote>
<p>so do you also get the "cannot unify things with binders (other than types)" panic?</p>
</blockquote>
<p>I can confirm this is a bug in chalk</p>



<a name="178660790"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/chalk%20dyn%20and%20impl%20Trait/near/178660790" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/chalk.20dyn.20and.20impl.20Trait.html#178660790">(Oct 21 2019 at 14:33)</a>:</h4>
<p>I was going to provide some feedback over in <a class="stream" data-stream-id="144729" href="/#narrow/stream/144729-wg-traits">#wg-traits</a> to help overcome it right now, in fact</p>



<a name="180755366"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/chalk%20dyn%20and%20impl%20Trait/near/180755366" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/chalk.20dyn.20and.20impl.20Trait.html#180755366">(Nov 14 2019 at 17:52)</a>:</h4>
<p>This <a href="https://github.com/rust-lang/chalk/pull/282" target="_blank" title="https://github.com/rust-lang/chalk/pull/282">might be fixed</a> now, but there were some <code>chalk</code> API changes and updating didn't seem trivial</p>



<a name="180758330"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/chalk%20dyn%20and%20impl%20Trait/near/180758330" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/chalk.20dyn.20and.20impl.20Trait.html#180758330">(Nov 14 2019 at 18:22)</a>:</h4>
<p>Yeah, I'm working on them</p>



<a name="180868495"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/chalk%20dyn%20and%20impl%20Trait/near/180868495" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/chalk.20dyn.20and.20impl.20Trait.html#180868495">(Nov 15 2019 at 20:26)</a>:</h4>
<p>it's looking good :)</p>



<a name="180868578"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/chalk%20dyn%20and%20impl%20Trait/near/180868578" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/chalk.20dyn.20and.20impl.20Trait.html#180868578">(Nov 15 2019 at 20:27)</a>:</h4>
<p><span class="user-mention" data-user-id="129457">@Florian Diebold</span> I've wished for better completions on various <code>impl DB</code> at least ten times today :D</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>